
import 'package:flutter/material.dart';

class AppBarUnit extends AppBar {
  final bool? back;
  final Function? onPressed;
  AppBarUnit({
    super.key,
     required Widget title,
    this.back,
    this.onPressed,

  }) : super(
    title: title,
    // 标题居中
    centerTitle: true,
    // 设置高度
    // 返回按钮
    leading: back == true? IconButton(
      color: Colors.white,
      icon: const Icon(Icons.arrow_back_ios_new),
      onPressed: () {
        if(onPressed!=null)
            onPressed();
      },
    ):null,
    backgroundColor: const Color.fromRGBO(29, 32, 41, 1),
    // 设置字体大小
    titleTextStyle: const TextStyle(
      fontSize: 16.0,
      fontWeight: FontWeight.normal,
    ),

  );
}
